<template>
  <div id="BrandApplication">
    <div v-if="hideImg">
      <div class="SQList">
        <ul class="listWrap">
          <div style="clear: both" v-if="contentData.length > 0">
            <li
              v-for="(item, index) in contentData"
              @click="contentDataClick(item)"
              :key="index"
              :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }"
            >
              <p class="p1">
                <span style="float: left">{{ item.HOUSEAPPLICANT }}</span>
                <!-- <span style="float: right">{{ item.HOUSEAPPLICANT }}</span> -->
                <span style="float: right; font-size: 14px; color: #848484">电子门牌</span>
              </p>
              <p class="p3">
                <span style="float: left">进度：{{ item.result }}</span>
                <span style="float: right">申请时间：{{ item.FYSQSJ }}</span>
              </p>
              <p class="p3">
                <span style="float: left"
                  >地址：{{ item.PERMANENTADDR ? item.PERMANENTADDR : '暂无数据' }}</span
                >
              </p>
            </li>
          </div>
          <div style="height: 60vh; text-align: center; padding-top: 20vh" v-else>
            <div style="margin-bottom: 10px">
              <img src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png" />
            </div>
            <div :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }">暂无数据</div>
          </div>
        </ul>
      </div>
    </div>
    <div v-else>
      <div class="title">
        <span
          @click="onClickLeft"
          style="position: absolute; left: 5px; display: flex; align-items: center; font-size: 14px"
        >
          <van-icon name="arrow-left" />返回
        </span>
      </div>
      <div style="width: 100%; height: calc(100vh - 50px)">
        <iframe style="width: 100%; height: 100%" :src="ImgUrl"></iframe>
      </div>
    </div>
  </div>
</template>

<script>
import { QuerySignCallback, getDoorplateList,FileServerProxy } from '../../utils/api'
export default {
  name: 'BrandApplication',
  data() {
    return {
      ImgUrl: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png',
      hideImg: true,
      showEdition: false,
      noData: false,
      ISGJ: false,
      handleGoto: 0,
      nowIndex: 1,
      contentData: [],
      bottomData: [
        {
          name: '首页',
          icon: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/20.png',
          icons: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/20-1.png',
        },
        {
          name: '我的待办',
          icons: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/21.png',
          icon: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/21-1.png',
        },
        {
          name: '我的收藏',
          icons: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/22.png',
          icon: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/22-1.png',
        },
      ],
    }
  },
  components: {},
  methods: {
    onClickLeft() {
      this.hideImg = true
    },
    bottomClick(index) {
      switch (index) {
        case 0:
          this.$router.push({
            path: '/',
          })
          break
        case 1:
          this.$router.push({
            path: 'MyAgent',
          })
          break
        case 2:
          this.$router.push({
            path: 'MyEnshrine',
          })
          break
      }
    },
    contentDataClick: async function (item) {
      // let params = {
      //     "accessCode": "0087bf6662ef11ec87416805cab640a0",
      //     "cityCode": window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
      //     "appKey": "6738b790-69e8-11ec-a673-6805cab640a0",
      //     "params": {
      //       "mainCodetype":"身份证",
      //       "mainName": item.proposerName,
      //       "mainCode": item.proposerOwnerIdentityNumber,
      //       "certcode":""
      //     }
      // }
      // const res = await QuerySignCallback(params)
      // if(res.data.code == 200){
      // this.hideImg = false
      // this.ImgUrl =
      // }
    },
    getcontentDataList: async function () {
      // let params = {
      //   "pageSize": "1000",
      //   "pageNo": "1",
      //   'cityCode': window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
      //   "accessCode":"40f38b1856c740529bdaed08f8d59e6d",
      //   'proposerName': '',
      //   'proposerOwnerIdentityNumber': ''
      // }
      let idcard = window.localStorage.getItem('DanDianid')
      let xcfycjtex = {
        procName: 'MPBL',
        dtParams: JSON.stringify([{ I_USERID: "'" + idcard + "'", TYPE: 5 }]),
        token: window.localStorage.getItem('token'),
      }
      let xcfycjtfn = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: xcfycjtex,
      }
      const resxcfycjt = await FileServerProxy(xcfycjtfn)
      let data = JSON.parse(resxcfycjt.data.data).Data
      if (data.length > 0) {
        this.contentData = data
        this.contentData.forEach((ele) => {
          if (ele.F_RESULT == 1) {
            ele.result = '已申请'
          } else {
            ele.result = '未申请'
          }
        })
      }
    },
  },
  mounted() {
    if (!this.$store.state.isGJ) {
      this.ISGJ = true
    }
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        title: '我的门牌办理申请',
      })
        .then((res) => {})
        .catch((err) => {})
    }
    this.showEdition = this.$store.state.Edition
    this.getcontentDataList()
  },
}
</script>

<style scoped lang="scss">
#BrandApplication {
  height: 100%;
  .title {
    width: 100%;
    height: 50px;
    background: #007aff;
    line-height: 50px;
    text-align: center;
    color: #ffffff;
    font-size: 20px;
    position: relative;
  }
  .SQList {
    width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    padding: 0 10px;
    li {
      padding-top: 10px;
      border-bottom: 1px solid #d2d2d2;
    }
  }
  /*padding: 10px;*/

  .bottom {
    clear: both;
    position: fixed;
    bottom: 0;
    // height: 100px;
    width: 100%;
    text-align: center;
    height: 0.88rem;
    background: #ffffff;
    border-top: 1px solid #d2d2d2;
    ul {
      width: 100%;
      height: 100%;
      clear: both;
      overflow: hidden;
      display: flex;
      align-items: center;
      li {
        float: left;
        width: 33.3%;
        font-size: 14px !important;
        img {
          height: 18px;
          margin-bottom: 0.0130px;
        }
      }
    }
  }
}
</style>
